1. Field of the Invention
The present invention relates to an image reader capable of reading printed images, etc. by sequentially scanning the same in a predetermined direction and compressing the read image data by coding the same. The present invention further relates to a facsimile machine having such an image reader.
2. Description of the Related Art
In recent years, facsimile machines play a significantly important role in the field of data communication. A facsimile machine reads an image printed on a sheet of paper, a hand-written image, etc. by a scanner formed of, for example, CCD (Charge-Coupled Device) image sensor and converts the read image into a digital signal. The digital signal is converted into a compressed digital signal by a coding system such as MH (Modified Huffman), MR (Modified READ), MMR (Modified MR), etc. The compressed digital signal is converted into an analog signal and output to a telephone line.
FIG. 1 is a representation showing the principle reading an original in a facsimile machine recommended by CCITT (International Telegraph and Telephone Consultative Committee). Referring to FIG. 1, an original 10 of ISO A4 size is, for example, read by a CCD sensor along the main scanning direction. One main scanning line is divided into 1728 pixels, and each of the pixels is converted into a digital signal in accordance with its luminance. Main scanning is repeated in the subscanning direction intersecting the main scanning direction. The original 10 will have been entirely converted into digital signals when the scanning in the subscanning direction is completed.
The image converted into a digital signal is compressed in accordance with a system such as the above-stated MH, MR, MMR. The compressed signal is output to a communication line through a modem and transmitted to a facsimile machine on the other party.
Processing opposite to that conducted on the transmission side is conducted on the reception side. More specifically, the facsimile machine on the reception side converts an analog signal which it receives into a digital signal. The converted digital signal is converted into the digital signal by expansion processing opposite to the compression. The original image is reproduced by printing the obtained digital signal in the same procedure as that when the image is read.
Compression/expansion of an original is performed for the purpose of increasing the efficiency of use of a communication line and reducing time required for communication by reducing the amount of data transmitted.
FIGS. 3 and 4 each represent a coding system of MH as an example. MH coding is of one-dimensional run length coding system. In this system, one line data is composed of a series of variable-length codes. Each code represents a white or black run length. The white run length is abbreviated as white run, and the black run length as black run. The white run and the black run are produced alternately. The lines each begin with a code of white run in order to ensure synchronism between a receiver and a signal. If a scanning line begins with the black run, a code representing the white run of length 0 is initially transmitted. The MH coding includes two kinds of codes: a terminating code and a make-up code.
FIG. 3 sets forth terminating codes. The terminating codes indicate run lengths in the range from 0 to 63 pixels. In order to increase compression efficiency, a short code is allotted for a run length often appearing in image information.
FIG. 4 sets forth make-up codes. The make-up codes are for representing run lengths in the range from 64 to 1728 pixels in combination with the terminating codes. A run length in the range between 64 and 1728 pixels is initially coded by a make-up code representing a run length equal to or shorter than that run length. Thereafter, a terminating code representing the difference between an actual run length and the run length represented by the make-up code follows.
The receiver can expand data by checking received data with a table for demodulation prepared in advance.
As stated above, transmission of an image by a facsimile machine can be conducted efficiently and in a reduced time period by compressing transmission data by means of coding.
Such a facsimile machine however bears the following problem. As shown in FIG. 1, compression by coding can be conducted efficiently when the original 10 is correctly supplied to the machine and the main scanning direction coincides with the direction in which character strings 12 extend.
However, as shown in FIG. 2, when the original 10 is deviated and supplied to the machine, and the main scanning direction does not coincide with the direction of the character strings 12, the compression efficiency degrades. This is for the following reason. The direction in which characters are arranged in character strings relative to the main scanning direction is hereinafter called "skew".
As described above, according to the coding system, a short code is allotted to a run length often appearing in image information and a relatively long code to a run length appearing not so frequently. Therefore, as shown in FIG. 2, when the direction of a main scanning line 14 read by the first main scanning does not coincide with the direction of the character strings 12, the frequency of a run length appearing becomes irregular, thereby degrading the efficiency of data compression.
Furthermore, as shown in FIG. 1, suppose that the character strings are placed at intervals of spacings d0. When the original 10 is supplied to the facsimile machine in the correct direction, a main scanning line existing in the spacing d0 includes white runs only. The image in this part can therefore be coded at a very high efficiency using the above-stated make-up codes. On the other hand, as shown in FIG. 2, when the original 10 is deviated and supplied to the facsimile machine, a main scanning line composed of white runs only is limited to a spacing d1. As can be seen from the figure, the spacing d1 is much smaller than the spacing d0. As compared to the case shown in FIG. 1, the compression efficiency in the case shown in FIG. 2 is therefore considerably degraded.
In order to solve such a problem, facsimile machines or the like capable of detecting such a deviation, coding and correcting the deviation are proposed, for example, in Japanese Patent Laying-Open No. 55-154871, Japanese Patent Laying-Open No. 62-206962, and Japanese Patent Laying-Open No. 63-88963.
Japanese Patent Laying-Open No. 55-154871 suggests a method of image reading using a specially marked sheet of paper for an original in a facsimile machine. The deviation of the original can be found by detecting this mark when the original is read. Coordinate transformation is made to the read data for canceling this deviation. This increases the efficiency of coding.
Japanese Patent Laying-Open No. 62-206962 proposes use of a sensor provided at the image reading portion of a facsimile machine and for detecting time when the leading edge of an original supplied passes the sensor. The spacial relation between two points at the leading edge of an original supplied at a prescribed speed can be found by detecting the time difference between the two points in passing the prescribed sensor. The size of the original supplied can also be found at that time. The deviation of the original can be detected from these kinds of information. Coordinate transformation is conducted to the obtained data so as to cancel the obtained deviation, thereby increasing the compression efficiency of the data.
Japanese Patent Laying-Open No. 63-88963 discloses a method of detecting the time when one end of an original in the subscanning direction is scanned based on a change of a signal level in reading the original in a facsimile machine. At the time of main scanning, writing of data of a main scanning line into an image memory is initiated using the time of detecting the end of a sheet as a reference. Using this method, one end of the original is stored into the image memory always in parallel with the end of the image memory. The deviation of the original is removed from the image, thereby increasing the compression efficiency.
The above-stated prior art technology still have the following problem yet to be solved. Consider a language such as Japanese whose characters can be written either vertically or horizontally. In the case of such a language, as shown in FIG. 5, a sheet of ISO A4 size with vertically written characters may be supplied to an image reader along the lengthwise direction of the sheet. In such a case, the compression efficiency can not be increased even when the deviation of the original itself is detected and corrected.
Also, even in the case of a document with horizontally written characters, a similar problem arises when the document is supplied to the image reader in the direction in coincidence with the direction in which the character strings extend.